<h1><?php echo $this->lang->line('title'); ?></h1>
<hr />
<ul class="nav nav-tabs">
    <li class="active"><a href="<?php echo admin_url('users'); ?>"><?php echo $this->lang->line('View user'); ?></a></li>
    <li><a href="<?php echo admin_url('users/add'); ?>"><?php echo $this->lang->line('Add user'); ?></a></li>
</ul>

<?php echo form_open($action, array('class' => 'form-horizontal well', 'id' => 'frmBlockUser')); ?>

<div class="block-section clearfix">
    <div class="floatLeft">
        <div class="btn-group" id="block-user-update">
            <a href="javascript: void(0)" class="btn btn-primary"><i class="icon-user icon-white"></i> <?php echo $this->lang->line('User'); ?></a>
            <a href="javascript: void(0)" data-toggle="dropdown" class="btn btn-primary dropdown-toggle"><span class="caret"></span></a>
            <input type="hidden" name="btn-Update" id="btn-Update" value="" />
            <input type="hidden" name="event" id="Event" value="" />
            <ul class="dropdown-menu">
                <li><a href="javascript: void(0);" rel="2"><i class="icon-trash"></i> <?php echo $this->lang->line('Delete'); ?></a></li>
                <li><a href="javascript: void(0);" rel="1"><i class="icon-ok"></i> <?php echo $this->lang->line('Publish'); ?></a></li>
                <li><a href="javascript: void(0);" rel="0"><i class="icon-remove"></i> <?php echo $this->lang->line('UnPublish'); ?></a></li>
            </ul>
        </div>

    </div>

    <div class="floatRight">
        <table id="frm-Search">
            <tr>
                <td width=200><?php echo form_input($frmSearch ['textsearch']) ?></td>
                <td><?php echo form_submit($frmSearch ['submit']) ?> <?php echo form_submit($frmSearch ['reset']) ?></td>
            </tr>
        </table>
    </div>
</div>
<?php
$arrConfig = array(
    'url' => admin_url('users/index'),
    'class' => array(
        'classUp' => 'desc',
        'classDown' => 'asc'
    ),
    'page' => $page,
    'colCurrent' => $column,
    'sort' => $sort,
    'column' => array(
        array('name' => 'first_name', 'label' => $this->lang->line('Firstname')),
        array('name' => 'last_name', 'label' => $this->lang->line('Lastname')),
        array('name' => 'username', 'label' => $this->lang->line('Username')),
        array('name' => 'email', 'label' => $this->lang->line('Email')),
        array('name' => 'status', 'label' => $this->lang->line('Status')),
        array('name' => 'role_id', 'label' => $this->lang->line('Role')),
        array('name' => 'created', 'label' => $this->lang->line('Datecreated')),
    )
);

$listColumnSort = sortListColumn($arrConfig);
?>
<table class="table table-bordered table-striped clear">
    <tr>
        <th><input type="checkbox" name="checkAllUser" id="checkAllUser" /></th>
        <th><?php echo $listColumnSort['first_name'] ?></th>
        <th><?php echo $listColumnSort['last_name'] ?></th>
        <th><?php echo $listColumnSort['username'] ?></th>
        <th><?php echo $listColumnSort['email'] ?></th>
        <th><?php echo $listColumnSort['status'] ?></th>
        <th><?php echo $listColumnSort['role_id'] ?></th>
        <th><?php echo $listColumnSort['created'] ?></th>
        <th><?php echo $this->lang->line('Functions'); ?></th>
    </tr>
    <?php if (isset($users) && count($users)) : ?>
        <?php foreach ($users as $key => $value) : ?>
            <?php $role = $this->role_model->getRole($value->role_id); ?>
            <tr>
                <td><input type="checkbox" name="checkListUser[]" class="checkListUser" value="<?php echo $value->userid; ?>" /></td>
                <td><?php echo $value->first_name; ?></td>
                <td><?php echo $value->last_name; ?></td>
                <td><?php echo $value->username; ?></td>
                <td><?php echo $value->email; ?></td>
                <td><?php echo ($value->status == 1) ? '<a href="' . admin_url('users/checkStatus/' . $value->userid) . '" title="' . $this->lang->line('Publish') . '"><i class="icon-ok"></i></a>' : '<a href="' . admin_url('users/checkStatus/' . $value->userid) . '" title="' . $this->lang->line('UnPublish') . '"><i class="icon-remove"></i></a>'; ?></td>
                <td><?php echo $role->role_name; ?></td>
                <td><?php echo date('Y-m-d', $value->created); ?></td>
                <td>
                    <a href="<?php echo admin_url('users/changepwd/' . $value->userid); ?>" class="btn"><?php echo $this->lang->line('ChangePwd'); ?></a>
                    <a href="<?php echo admin_url('users/edit/' . $value->userid); ?>" class="btn btn-primary"><?php echo $this->lang->line('Edit'); ?></a>
                    <a href="<?php echo admin_url('users/delete/' . $value->userid); ?>" onclick="return confirm('<?php echo $this->lang->line('del_warming') ?>')" class="btn btn-danger"><i class="icon-trash icon-white"></i> <?php echo $this->lang->line('Delete'); ?></a>
                </td>
            </tr>
        <?php endforeach; ?>
    <?php endif; ?>

</table>
<?php if (isset($pagination)) echo $pagination; ?>

<?php echo form_close() ?>